home *** CD-ROM | disk | FTP | other *** search
/ Super Shareware Collection / Super Shareware Collection.iso / os_2 / memsz220.zip / ABOUT.CPP next >
Text File  |  1994-02-07  |  5KB  |  163 lines

  1. /******************************************************************* ABOUT.CC
  2.  *                                        *
  3.  *              Generic "About" Dialog                *
  4.  *                                        *
  5.  ****************************************************************************/
  6.  
  7. #define INCL_BASE
  8. #define INCL_PM
  9. #include <os2.h>
  10.  
  11. #include "debug.h"
  12. #include "support.h"
  13. #include "about.h"
  14.  
  15.  
  16. /****************************************************************************
  17.  *                                        *
  18.  *               Definitions & Declarations                *
  19.  *                                        *
  20.  ****************************************************************************/
  21.  
  22. static METHODFUNCTION InitDlg ;
  23. static METHODFUNCTION Command ;
  24. static METHODFUNCTION OK ;
  25. static METHODFUNCTION Cancel ;
  26.  
  27.  
  28. /****************************************************************************
  29.  *                                        *
  30.  *    "About" Dialog Processor                        *
  31.  *                                        *
  32.  ****************************************************************************/
  33.  
  34. extern MRESULT EXPENTRY AboutProcessor
  35. (
  36.   HWND hwnd,
  37.   USHORT msg,
  38.   MPARAM mp1,
  39.   MPARAM mp2
  40. )
  41. {
  42.  /***************************************************************************
  43.   *                Declarations                    *
  44.   ***************************************************************************/
  45.  
  46.   static METHOD Methods [] =
  47.   {
  48.     { WM_INITDLG, InitDlg },
  49.     { WM_COMMAND, Command }
  50.   } ;
  51.  
  52.  /***************************************************************************
  53.   * Dispatch the message according to the method table and return the        *
  54.   *   result.  Any messages not defined above get handled by the system     *
  55.   *   default dialog processor.                         *
  56.   ***************************************************************************/
  57.  
  58.   return ( DispatchMessage ( hwnd, msg, mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), WinDefDlgProc ) ) ;
  59. }
  60.  
  61. /****************************************************************************
  62.  *                                        *
  63.  *    Initialize Dialog                            *
  64.  *                                        *
  65.  ****************************************************************************/
  66.  
  67. static MRESULT APIENTRY InitDlg
  68.   HWND hwnd, 
  69.   USHORT msg,
  70.   MPARAM mp1, 
  71.   MPARAM mp2
  72. )
  73. {
  74.   PABOUT_PARMS Parms = (PABOUT_PARMS) ( PVOIDFROMMP ( mp2 ) ) ;
  75.  
  76.   WinSetWindowUShort ( hwnd, QWS_ID, Parms->id ) ;
  77.  
  78.   if ( Parms->hwndHelp )
  79.   {
  80.     WinAssociateHelpInstance ( Parms->hwndHelp, hwnd ) ;
  81.   }
  82.  
  83.   return ( MRFROMSHORT ( FALSE ) ) ;
  84. }
  85.  
  86. /****************************************************************************
  87.  *                                        *
  88.  *    Process commands received by the About Dialog                *
  89.  *                                        *
  90.  ****************************************************************************/
  91.  
  92. static MRESULT APIENTRY Command
  93.   HWND hwnd, 
  94.   USHORT msg, 
  95.   MPARAM mp1, 
  96.   MPARAM mp2
  97. )
  98. {
  99.  /***************************************************************************
  100.   * Local Declarations                                *
  101.   ***************************************************************************/
  102.  
  103.   static METHOD Methods [] =
  104.   {
  105.     { DID_OK,      OK     },
  106.     { DID_CANCEL, Cancel },
  107.   } ;
  108.  
  109.  /***************************************************************************
  110.   * Dispatch the message without a default message processor.            *
  111.   ***************************************************************************/
  112.  
  113.   return ( DispatchMessage ( hwnd, SHORT1FROMMP(mp1), mp1, mp2, Methods, sizeof(Methods)/sizeof(Methods[0]), NULL ) ) ;
  114. }
  115.  
  116. /****************************************************************************
  117.  *                                        *
  118.  *    Process the About Dialog's OK button being pressed.                 *
  119.  *                                        *
  120.  ****************************************************************************/
  121.  
  122. static MRESULT APIENTRY OK
  123.   HWND hwnd, 
  124.   USHORT msg, 
  125.   MPARAM mp1, 
  126.   MPARAM mp2
  127. )
  128. {
  129.  /***************************************************************************
  130.   * Dismiss the dialog with a TRUE status.                    *
  131.   ***************************************************************************/
  132.  
  133.   WinDismissDlg ( hwnd, TRUE ) ;
  134.  
  135.   return ( 0 ) ;
  136. }
  137.  
  138. /****************************************************************************
  139.  *                                        *
  140.  *    Process the About Dialog's being cancelled.                         *
  141.  *                                        *
  142.  ****************************************************************************/
  143.  
  144. static MRESULT APIENTRY Cancel
  145.   HWND hwnd, 
  146.   USHORT msg, 
  147.   MPARAM mp1, 
  148.   MPARAM mp2
  149. )
  150. {
  151.  /***************************************************************************
  152.   * Dismiss the dialog with a TRUE status.                    *
  153.   ***************************************************************************/
  154.  
  155.   WinDismissDlg ( hwnd, FALSE ) ;
  156.  
  157.   return ( 0 ) ;
  158. }
  159.